﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using Zhaoxi.Industrial.Base;

namespace Zhaoxi.Industrial.ViewModel
{
    class MainViewModel:NotifyPropertyBase
    {
		private UIElement _mainContent;

		public UIElement MainContent
		{
			get { return _mainContent; }
			set { 
                Set<UIElement>(ref _mainContent, value); 
            }
		}

		public CommandBase TagChangedcommand { get; set; }

        public MainViewModel()
        {
            TagChangedcommand = new CommandBase(Command);
            Command("Zhaoxi.Industrial.View.SystemMonitor");
        }

        public void Command(object obj) {
            if (obj == null) return;
            
            //string[] strValues = o.ToString().Split("|");
            //Assembly assembly = Assembly.LoadFrom(strValues[0]);
            //Type type = assembly.GetType(strValues[1]);
            //this.MainContent = (UIElement)Activator.CreateInstance(type);

            Type type = Type.GetType(obj.ToString());
            this.MainContent = (UIElement)Activator.CreateInstance(type);
        }
    }
}
